package com.util;

import com.po.Course;
import com.vo.CourseVo;

import java.sql.Timestamp;

/**
 * Created by 阳幸子 on 2018/5/8.
 */
public class DataFormat {
    public static Course  voFormat(CourseVo courseVo) {
        Course course=new Course();
        if(courseVo.getCoachId()!=0){
            course.setCoach_id(courseVo.getCoachId());
        }
       if(courseVo.getCourseTypeId()!=0){
           course.setCourse_type_id(courseVo.getCourseTypeId());
       }
        if(courseVo.getCourseDesc()!=null&&courseVo.getCourseDesc().equals("")==false){
            course.setCourse_desc(courseVo.getCourseDesc());
        }
        if(courseVo.getCourseDesc()!=null&&courseVo.getCourseName().equals("")==false){
            course.setCourse_name(courseVo.getCourseName());
        }
        if(courseVo.getStartTime()!=null){
            course.setStart_time(Timestamp.valueOf(courseVo.getStartTime()));
        }
        if(courseVo.getEndTime()!=null){
            course.setEnd_time(Timestamp.valueOf(courseVo.getEndTime()));
        }




        course.setCtype("course");
        return course;
    }

}
